/*    */ package com.lmpop.frame.util;
/*    */ 
/*    */ import com.redfin.sitemapgenerator.ChangeFreq;
/*    */ import com.redfin.sitemapgenerator.SitemapGeneratorBuilder;
/*    */ import com.redfin.sitemapgenerator.W3CDateFormat;
/*    */ import com.redfin.sitemapgenerator.W3CDateFormat.Pattern;
/*    */ import com.redfin.sitemapgenerator.WebSitemapGenerator;
/*    */ import com.redfin.sitemapgenerator.WebSitemapUrl;
/*    */ import com.redfin.sitemapgenerator.WebSitemapUrl.Options;
/*    */ import java.io.File;
/*    */ import java.net.MalformedURLException;
/*    */ import java.util.Date;
/*    */ import java.util.List;
/*    */ import java.util.TimeZone;
/*    */ 
/*    */ public class SiteMapGenerator
/*    */ {
/* 18 */   private WebSitemapGenerator sitemapGenerator = null;
/*    */ 
/*    */   public SiteMapGenerator()
/*    */   {
/*    */   }
/*    */ 
/*    */   public SiteMapGenerator(String baseUrl, File baseDir)
/*    */   {
/*    */     try
/*    */     {
/* 28 */       W3CDateFormat dateFormat = new W3CDateFormat(W3CDateFormat.Pattern.DAY);
/* 29 */       dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+8"));
/* 30 */       this.sitemapGenerator = ((WebSitemapGenerator)((SitemapGeneratorBuilder)WebSitemapGenerator.builder(baseUrl, baseDir).dateFormat(dateFormat)).build());
/*    */     }
/*    */     catch (MalformedURLException e) {
/* 33 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public void setWebsiteInformation()
/*    */   {
/*    */     try
/*    */     {
/* 41 */       if (this.sitemapGenerator == null) {
/* 42 */         return;
/*    */       }
/* 44 */       WebSitemapUrl url = null;
/* 45 */       for (int i = 0; i <= 100; i++) {
/* 46 */         url = ((WebSitemapUrl.Options)((WebSitemapUrl.Options)new WebSitemapUrl.Options("http://frame.lmpop.com/index" + i + ".html").lastMod(new Date())).changeFreq(ChangeFreq.DAILY)).build();
/* 47 */         this.sitemapGenerator.addUrl(url);
/*    */       }
/*    */ 
/*    */     }
/*    */     catch (MalformedURLException e)
/*    */     {
/* 54 */       e.printStackTrace();
/*    */     }
/*    */   }
/*    */ 
/*    */   public void generateSiteMap()
/*    */   {
/* 61 */     List fileList = null;
/*    */ 
/* 63 */     if (this.sitemapGenerator == null) {
/* 64 */       return;
/*    */     }
/*    */ 
/* 67 */     fileList = this.sitemapGenerator.write();
/*    */   }
/*    */ 
/*    */   public static void main(String[] args)
/*    */   {
/* 74 */     File baseFile = new File("D:\\sitemaptest");
/* 75 */     String baseUrl = "http://frame.lmpop.com";
/*    */ 
/* 77 */     SiteMapGenerator generator = new SiteMapGenerator(baseUrl, baseFile);
/* 78 */     generator.setWebsiteInformation();
/* 79 */     generator.generateSiteMap();
/*    */   }
/*    */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.frame.util.SiteMapGenerator
 * JD-Core Version:    0.6.0
 */